﻿@using VirtualPress.Infrastructure.Entities.Entity;
@using VirtualPress.Infrastructure.Entities.Enum;
@using VirtualPress.Tool.Framework;
@using VirtualPress.Infrastructure.HitMonitor;
@{
    Article article = ViewBag.Article;
    Periodical journal = ViewBag.Journal;
    PeriodicalItem journalItem = ViewBag.JournalItem;
    List<ArticleAuthor> authorsList = ViewBag.ArticleAuthor;
    Appendix attachment = ViewBag.Attachment;
    ViewBag.Title = article.Title;
    ViewBag.Keywords = String.Format("{0},{1},{2}", article.Title, article.KeyWords.Replace("；", ","), article.KeyWords_EN);
    ViewBag.Description = article.Abstract;
    Layout = "~/Views/Shared/_Main.cshtml";
}
@section head
{
    <style type="text/css">
        .tab-content p
        {
            text-align: justify;
        }
    </style>
}
<div class="container">
    <div class="row">
        <div class="span9">
            <!-- navagation -->
            <ul class="breadcrumb">
                <li><a href="/">首页</a> <span class="divider">/</span></li>
                <li><a href="/journals/home/list/@((int)journal.IndType)">@journal.IndType.Mapping()</a>
                    <span class="divider">/</span></li>
                <li><a href="/journals/home/detail/@journal.Id">@journal.Name</a> <span class="divider">
                    /</span></li>
                <li class="active">@article.Title</li>
            </ul>
            <div class="mini-layout" style="height: 260px;">
                <!-- journal img -->
                <div class="span2">
                    <img src="@journal.CoverImg" alt="@journal.Name" /></div>
                <!-- journal description -->
                <div class="span6">
                    <h4>
                        <a href="/journals/home/detail/@journal.Id" target="_blank">@journal.Name</a></h4>
                    <h5>
                        @journal.Name_EN</h5>
                    <hr class="grayline01" />
                    <p>
                        @journal.Introduction</p>
                    <p>
                        SSN Print: @journal.ISSN_Print<br />
                        ISSN Online: @journal.ISSN_Online<br />
                        编辑部邮箱：@journal.Email<br />
                    </p>
                </div>
            </div>
            <div class="tabbable">
                <!-- Only required for left/right tabs -->
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#tab1" data-toggle="tab">文章详情</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="tab1">
                        <h5>
                            @article.Title</h5>
                        @article.Title_EN
                        <hr class="grayline01" />
                        <p>
                            @{ string authors = string.Empty;

                               for (int i = 0, len = authorsList.Count(); i < len; i++)
                               {
                                   authors += authorsList[i].AuthorName;
                                   if (i != len - 1)
                                   {
                                       authors += "，";
                                   }
                               }
                            }
                            @authors</p>
                        <p>
                            @article.CreateTime.ToString("yyyy 年") 第 @journalItem.Manuscriptcode 期</p>
                        <p>
                            <code>文章摘要</code></p>
                        <p>
                            <b>摘要：</b>@article.Abstract</p>
                        <p>
                            <b>关键词：</b>@article.KeyWords
                        </p>
                        <p>
                            <b>Abstract:</b> @article.Abstract_EN</p>
                        <p>
                            <b>KeyWords:</b> @article.KeyWords_EN
                        </p>
                        <p>
                            <code>下载</code> <a href="/download?token=@EncodeByBase64.Encode(new { id = attachment.Id, journal = article.Peri_Id, article = article.Id, type = 9 }.ToJson())" title="下载" target="_blank">
                                <i class="icon-download-alt"></i>@attachment.FileName</a>( @( attachment == null ? "" : attachment.Format + " " + attachment.Size)&nbsp;
                            <a class="label label-info" title="下载数">@(HitMonitor.Instance(HitName.Article, article.Id).GetValue<ArticleHitPack>().DownloadNumber)</a>
                            )
                        </p>
                    </div>
                </div>
            </div>
        </div>
        <div class="span3">
            <div class="mini-layout" style="height: 500px;">
                <div class="hspace15">
                </div>
                @if (HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    var user = new User().Find(HttpContext.Current.User.Identity.Name);
                    if (user.SystemRole == VirtualPress.Infrastructure.Entities.Enum.UserRole.Member)
                    {
                    <div style="text-align: center;">
                        <a href="/WorkSpace/member/Contribute?journal=@journal.Id" class="btn btn-primary btn-large" style="width: 73%">
                            我要投稿</a>
                    </div>
                    }
                    else
                    {
                    <div style="text-align: center;">
                        <a href="/Home/invalid/@journal.Id" class="btn btn-primary btn-large" style="width: 73%">
                            我要投稿</a>
                    </div>
                    }
                }
                else
                { 
                    <div style="text-align: center;">
                        <a href="/WorkSpace/member/Contribute?journal=@journal.Id" class="btn btn-primary btn-large" style="width: 73%">
                            我要投稿</a>
                    </div>
                }
                <div class="hspace10">
                </div>
                <div style="text-align: center;">
                    <a class="btn btn-large btn-danger" style="width: 73%">我要审稿</a>
                </div>
                <div class="hspace15">
                </div>
                <div style="text-align: center;">
                    <a class="btn btn-large" style="width: 73%">成为编委</a>
                </div>
                <div class="hspace15">
                </div>
                <div class="hspace15">
                </div>
                <div style="text-align: center;">
                    <div class="well">
                        @{var box = HitMonitor.Instance(HitName.Journal, journal.Id).GetValue<JournalHitPack>();}
                        <code>本刊下载量：<a>@box.DownloadNumber</a></code>
                        <div class="hspace10">
                        </div>
                        <code>本刊访问量：<a>@box.VisitNumber</a></code>
                    </div>
                </div>
                <div class="friendlinktop">
                    相关期刊
                    <hr class="flline" />
                </div>
                <div class="flinks">
                    <ul>
                        @{
                            List<Periodical> relation = ViewBag.RelationJournal;
                            if (relation != null && relation.Any())
                            {
                                foreach (var item in relation)
                                {
                            <li><a target="_blank" href="/journals/home/detail/@item.Id">@item.Name</a></li>
                                }
                            }
                        }
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
